//
//  WXSDreamTalkBubbleCell.m
//  SleepBooks
//
//  Created by 王勇 on 2016/9/23.
//  Copyright © 2016年 rimi. All rights reserved.
//

#import "WXSDreamTalkBubbleCell.h"
#import "WXSDreamTalkBubble.h"
@interface WXSDreamTalkBubbleCell()
@property (weak, nonatomic) IBOutlet UILabel *startTimeLabel;
@property (weak, nonatomic) IBOutlet UILabel *lengthLabel;

@end

@implementation WXSDreamTalkBubbleCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

-(void)setModel:(WXSDreamTalkModel *)model{
    _model = model;
    
    //设置梦话开始时间
    NSDateFormatter *formatter =[[NSDateFormatter alloc]init];
    [formatter setDateFormat:@"hh:mm"];
    self.startTimeLabel.text = [formatter stringFromDate:model.recordStartTime];
    
    //设置梦话的时长
    self.lengthLabel.text = [NSString stringWithFormat:@"%d",(int)model.recordDuration];
    
    //设置bubble
    WXSDreamTalkBubble *bubble = [WXSDreamTalkBubble bubble];
    bubble.model = model;
    bubble.frameX = 60;
    bubble.frameY = 5;
    [self.contentView addSubview:bubble];
}

@end
